﻿@using Adf.FrameWork.Service.HtmlHelperEx
@using Adf.FrameWork.Service.LayUi
@using CYQ.Data.Table
@{
    MDataRow drUser = ViewBag.drUser ?? new MDataRow();

}



<html>
<head>
    <meta charset="utf-8">
    <script src="/Style/js/jquery-3.4.1.min.js"></script>

    <script src="~/upload/ueditor/ueditor.all.min.js"></script>
    <script src="~/upload/ueditor/ueditor.config.js"></script>

    <link href="~/Style/layui/css/layui.css" rel="stylesheet" />

    <style>
        .layui-form-label {
            width: 150px
        }
    </style>
</head>

<body class="layui-layout-body">
    <!--主体 start-->

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">

                    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;">
                        <legend>
                            @drUser.Get("username", "")- 修改密码 - <button class="save layui-btn-danger layui-btn-xs layui-btn" lay-filter="btnSubmit" lay-submit="">保存</button>
                        </legend>
                        <br>
                        <div class="layui-card-body">

                            <div class="layui-form" lay-filter="">

                                <div class="layui-form-item">

                                    <div class=" layui-col-xs12 layui-col-md3">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">请输入旧密码</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" id="oldpwd" name="oldpwd" type="password">
                                                @Html.ExHidden("usercode", drUser.Get("usercode", ""))
                                            </div>
                                        </div>
                                    </div>


                                </div>

                            </div>
                            <div class="layui-form" lay-filter="">
                                <div class="layui-form-item">
                                <div class=" layui-col-xs12 layui-col-md3">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">请输入新密码</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="newpwd1" name="newpwd1" verify="passwd" type="password">
                                        </div>
                                    </div>
                                </div>


                                </div>

                            </div>
                            
                            <div class="layui-form" lay-filter="">
                                <div class="layui-form-item">

                                <div class=" layui-col-xs12 layui-col-md3">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">请再次输入新密码</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" id="newpwd2" name="newpwd2" verify="passwd" type="password">
                                        </div>
                                    </div>
                                </div>


                                </div>


                            </div>

                        </div>
                    </fieldset>
                </div>
            </div>
        </div>
    </div>




    <!--主体 End-->
    <!--底部 开始-->
    <script src="~/Style/layui/layui.js"></script>

    <script src="~/Style/layui/adfCommon.js"></script>
    <script>
        layui.config({
            base: '/style/v2/layuiadmin/lib/' //静态资源所在路径
        }).use(['layer', 'form', 'upload'], function () {
            var layer = layui.layer,
                form = layui.form,
                upload = layui.upload,
                adfCommon = layui.adfCommon;


            var sUrl = "/user/execute";



            $(".save").click(function () {
                $.ajax({
                    url: sUrl,

                    data: {
                        doCmd: "modifypwd",
                        oldpwd: $("#oldpwd").val(),
                        newpwd1: $("#newpwd1").val(),
                        newpwd2: $("#newpwd2").val(),
                        usercode: $("#usercode").val()
                    },

                    type: "POST",
                    success: function (retData) {
                        if (retData.RetStatus == 101) {
                            alert('修改成功');
                            layer.msg('修改成功');
                            var indexUrl = "/home/index?usercode=" + $("#usercode").val();
                            window.location.href = indexUrl;
                        } else if (retData.RetStatus != 101) {
                            layer.msg('修改失败');
                        }
                    }
                });
            });

        });
    </script>
    <!--底部 结束-->

</body>
</html>
